package com.everest.tribalapp;

import java.io.DataOutputStream;
import java.io.File;
import java.io.FileInputStream;
import java.io.UnsupportedEncodingException;
import java.net.HttpURLConnection;
import java.net.MalformedURLException;
import java.net.URL;
import java.net.URLEncoder;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Random;

import org.json.JSONObject;

import com.everest.tribalapp.Desa_Form7.upload;

import android.annotation.SuppressLint;
import android.annotation.TargetApi;
import android.app.Activity;
import android.app.Dialog;
import android.app.ProgressDialog;
import android.content.Context;
import android.content.Intent;
import android.content.SharedPreferences;
import android.database.Cursor;
import android.graphics.Bitmap;
import android.graphics.BitmapFactory;
import android.location.Location;
import android.location.LocationListener;
import android.location.LocationManager;
import android.net.ConnectivityManager;
import android.net.NetworkInfo;
import android.net.Uri;
import android.os.AsyncTask;
import android.os.Build;
import android.os.Bundle;
import android.os.Environment;
import android.provider.MediaStore;
import android.util.Log;
import android.view.Gravity;
import android.view.LayoutInflater;
import android.view.View;
import android.view.View.OnClickListener;
import android.view.ViewGroup;
import android.view.Window;
import android.widget.Button;
import android.widget.EditText;
import android.widget.ImageView;
import android.widget.TextView;
import android.widget.Toast;

@SuppressLint("NewApi")
@TargetApi(Build.VERSION_CODES.GINGERBREAD)
public class Dering_Pengelola_8 extends Activity implements OnClickListener
{


private static String GMAIL_EMAIL_ID = "sarimas.teknologi@gmail.com";
private static String GMAIL_ACCOUNT_PASSWORD = "tooriski2012";
private static String TO_ADDRESSES = "none";
	private Button send;
	private String[] choice;
	protected int id;
	protected String selectvalue;
	private int flag=0;
	private TextView dering_f8_qes_1;
	private TextView dering_f8_qes_2;
	private TextView dering_f8_qes_3;
	private TextView dering_f8_qes_4;
	private TextView dering_f8_qes_5;
	private TextView dering_f8_qes_6;
	private String value;
	private Button prev;
	private EditText dering_f8_ans_username;
	private EditText dering_f8_ans_date;
	private EditText dering_f8_ans_responden;
	private EditText dering_f8_ans_lan;
	private EditText dering_f8_ans_long;
	private EditText dering_f8_ans_phone;
	private String f1_5;
	private String f1_6;
	private String f1_7;
	private String f2_1;
	private String f2_2;
	private String f2_3;
	private String f2_4;
	private String f2_5;
	private String f2_6a;
	private String f2_6b;
	private String f3_1a;
	private String f3_1b;
	private String f3_2a1a;
	private String f3_2a1a1;
	private String f3_2a1a2;
	private String f3_2a1a3;
	private String f3_2a1a4;
	private String f3_2a1b;
	private String f3_2a1b1;
	private String f3_2a1b2;
	private String f3_2a1b3;
	private String f3_2a1b4;
	private String f3_2a2a1;
	private String f3_2a2a2;
	private String f3_2a2a3;
	private String f3_2a2a4;
	private String f3_2a2b1;
	private String f3_2a2b2;
	private String f3_2a2b3;
	private String f3_2a2b4;
	private String f3_2a31;
	private String f3_2a33;
	private String f3_2a32;
	private String f3_2a34;
	private String f3_2a41;
	private String f3_2a43;
	private String f3_2a44;
	private String f3_2a42;
	private String f3_2a51;
	private String f3_2a53;
	private String f3_2a52;
	private String f3_2a54;
	private String f3_2a62;
	private String f3_2a61;
	private String f3_2a63;
	private String f3_2a71;
	private String f3_2a64;
	private String f3_2a72;
	private String f3_2a73;
	private String f3_2a74;
	private String f3_2a81;
	private String f3_2a82;
	private String f3_2a84;
	private String f3_2a91;
	private String f3_2a83;
	private String f3_2a92;
	private String f3_2a93;
	private String f3_2a94;
	private String f3_2b1a2;
	private String f3_2b1a1;
	private String f3_2b1a3;
	private String f3_2b1a4;
	private String f3_2b1b1;
	private String f3_2b1b2;
	private String f3_2b1b3;
	private String f3_2b21;
	private String f3_2b1b4;
	private String f3_2b22;
	private String f3_2b23;
	private String f3_2b24;
	private String f3_2b31;
	private String f3_2b32;
	private String f3_2b33;
	private String f3_2b34;
	private String f3_2b41;
	private String f3_2b42;
	private String f3_2b43;
	private String f3_2b44;
	private String f3_2b51;
	private String f3_2b52;
	private String f3_2b53;
	private String f3_2b54;
	private String f3_2b61;
	private String f3_2b62;
	private String f3_2b63;
	private String f3_2b64;
	private String f3_3;
	private String f3_4;
	private String f3_5a;
	private String f3_5b;
	private String f3_5c;
	private String f3_5d;
	private String f4_1;
	private String f4_2a;
	private String f4_2b;
	private String f4_3;
	private String f4_4;
	private String f4_5;
	private String f4_6;
	private String f4_7;
	private String f4_8;
	private String f4_9;
	private String f4_14;
	private String f4_16;
	private String f5_1;
	private String f5_2;
	private String f5_3;
	private String f5_4;
	private String f5_6;
	private String f5_8;
	private String f5_10;
	private String f5_11;
	private String f5_12;
	private String f6_1a;
	private String f6_1b;
	private String f6_2a;
	private String f6_2b;
	private String f6_3a;
	private String f6_3b;
	private String f6_4a;
	private String f6_4b;
	private String f6_5;
	private String f6_6;
	private String f6_7a1;
	private String f6_7a2;
	private String f6_7a3;
	private String f6_7b1;
	private String f6_7b2;
	private String f6_7b3;
	private String f6_7c1;
	private String f6_7c2;
	private String f6_7c3;
	private String f6_91a1;
	private String f6_8;
	private String f6_91a2;
	private String f6_91a3;
	private String f6_91b1;
	private String f6_91b2;
	private String f6_91b3;
	private String f6_91c1;
	private String f6_91c2;
	private String f6_921;
	private String f6_91c3;
	private String f6_923;
	private String f6_922;
	private String f6_931;
	private String f6_932;
	private String f6_933;
	private String f7_1;
	private boolean f4_10a;
	private boolean f4_10b;
	private boolean f4_11a;
	private boolean f4_11b;
	private boolean f4_11c;
	private boolean f4_11d;
	private boolean f4_12a;
	private boolean f4_12b;
	private boolean f4_12c;
	private boolean f4_12d;
	private boolean f4_13a;
	private boolean f4_13b;
	private boolean f4_13c;
	private boolean f4_13d;
	private boolean f4_13e;
	private boolean f4_13f;
	private boolean f4_13g;
	private boolean f4_13h;
	private boolean f4_13i;
	private boolean f4_13j;
	private boolean f4_15a;
	private boolean f4_15b;
	private boolean f4_15c;
	private boolean f4_15d;
	private boolean f4_15e;
	private boolean f4_15f;
	private boolean f4_15g;
	private boolean f4_15h;
	private boolean f4_15i;
	private boolean f4_15j;
	private boolean f5_5a;
	private boolean f5_5b;
	private boolean f5_5c;
	private boolean f5_5d;
	private boolean f5_7a;
	private boolean f5_7b;
	private boolean f5_9a;
	private boolean f5_9b;
	private boolean f5_9c;
	private boolean f5_9d;
	private boolean f5_13a;
	private boolean f5_13b;
	private boolean f5_13c;
	private boolean f5_13d;
	private boolean f5_13e;
	private boolean f5_13f;
	private boolean f5_13g;
	private boolean f7_2a;
	private boolean f7_2b;
	private boolean f7_3a;
	private boolean f7_3b;
	private boolean f7_3c;
	private boolean f7_3d;
	private boolean f7_3e;
	private boolean f7_3f;
	private String f8_1;
	private String f8_2;
	private String f8_3;
	private String f8_4;
	private String f8_5;
	private String f8_6;
	public int i=0;
	private String f1_1;
	private String f1_2;
	private String f1_3;
	private String f1_4;
	private Calendar c;
	private SimpleDateFormat df;
	private String formattedDate;
	private Button browse1;
	private Button browse2;
	private String filePath;
	static final int CUSTOM_DIALOG_ID = 1;
	private static final int PICK_IMAGE = 1;
	private final int CAMERA_RESULT = 0;
	private ImageView img;
	private String nameimage;
	private Bitmap bitmap;
	private String _path;
	private String newimgname;
	private Dialog dialog;
	private TextView fromgallery;
	private TextView takeimage;
	private String newloc;
	private String newimgloc;
	private String toname;
	private String filePath1;
	private String nameimage1;
	private int serverResponseCode;
	private String fileName;
	private String serverResponseMessage;
	protected int image_flag=0;
	private ImageView img1;
	private int serverResponseCode1;
	private String serverResponseMessage1;
	@Override
	public void onBackPressed() 
	{
		
	}
	@SuppressLint("NewApi")
	@TargetApi(Build.VERSION_CODES.GINGERBREAD)
	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		Dering_Pengelola_8.this.requestWindowFeature(Window.FEATURE_NO_TITLE);
		setContentView(R.layout.dering_pengelola_8);
		
		 initialization();
		
			dering_f8_ans_date.setText(Global.date);
			dering_f8_ans_date.setFocusable(false);
			browse1.setOnClickListener(new OnClickListener() 
			{
				
				@Override
				public void onClick(View arg0)
				{
					try 
					{
						image_flag=1;
						showDialog(CUSTOM_DIALOG_ID);
						
					} 
					catch (Exception e)
					{
						System.out.println(e);
					}
					
				}
			});
			browse2.setOnClickListener(new OnClickListener() 
			{
				
				@Override
				public void onClick(View arg0)
				{
					try 
					{
						image_flag=2;
						showDialog(CUSTOM_DIALOG_ID);
						
					} 
					catch (Exception e)
					{
						System.out.println(e);
					}
					
				}
			});
		 prev.setOnClickListener(new OnClickListener() {
				
				@Override
				public void onClick(View v) {
					// TODO Auto-generated method stub
					Intent in=new Intent(getApplicationContext(),Dering_Pengelola_7.class);
					startActivity(in);
					Dering_Pengelola_8.this.finish();
				}
			});
		 send.setOnClickListener(new OnClickListener() {
			
			@TargetApi(Build.VERSION_CODES.GINGERBREAD)
			@SuppressLint("NewApi")
			@Override
			public void onClick(View v) 
			{
				boolean answer;
		        answer=isOnline();
		        System.out.println(answer);
		        f8_1=dering_f8_ans_username.getText().toString().trim();
		        f8_2=dering_f8_ans_date.getText().toString().trim();
		        f8_3=dering_f8_ans_responden.getText().toString().trim();
		        f8_4=dering_f8_ans_phone.getText().toString().trim();
		        f8_5=dering_f8_ans_lan.getText().toString().trim();
		        f8_6=dering_f8_ans_long.getText().toString().trim();
		      
				senddetails();
		        
			}
		});
		 boolean answer;
	        answer=isOnline();
	        System.out.println(answer);
	        if(answer)
	        {
	        	LocationManager L = (LocationManager) getSystemService(LOCATION_SERVICE);
			if (L.isProviderEnabled(LocationManager.NETWORK_PROVIDER)) 
			{
			LocationListener ll = new mylocationlistener();
			L.requestLocationUpdates(LocationManager.NETWORK_PROVIDER, 0, 0, ll);
			}
			else
			{
				Intent in = new Intent(android.provider.Settings.ACTION_LOCATION_SOURCE_SETTINGS);   
				startActivity(in);
			}
	        }
	        else
	        {
	        	Toast.makeText(getApplicationContext(), "Enable Your Internet",3000).show();
	        }
	}

	

	private void initialization() {
		

		prev=(Button)findViewById(R.id.previous);
		send=(Button)findViewById(R.id.send);
		dering_f8_ans_username=(EditText)findViewById(R.id.dering_f8_ans_username);
		dering_f8_ans_date=(EditText)findViewById(R.id.dering_f8_ans_date);
		dering_f8_ans_responden=(EditText)findViewById(R.id.dering_f8_ans_responden);
		dering_f8_ans_lan=(EditText)findViewById(R.id.dering_f8_ans_lati);
		dering_f8_ans_long=(EditText)findViewById(R.id.dering_f8_ans_longi);
		dering_f8_ans_phone=(EditText)findViewById(R.id.dering_f8_ans_phone);
		img=(ImageView)findViewById(R.id.imageView1_dering);
		img1=(ImageView)findViewById(R.id.imageView2_dering);
		browse1=(Button)findViewById(R.id.browse1_dering);
		browse2=(Button)findViewById(R.id.browse2_dering);
		dering_f8_qes_1=(TextView)findViewById(R.id.dering_f8_qes_1);
		dering_f8_qes_2=(TextView)findViewById(R.id.dering_f8_qes_2);
		dering_f8_qes_3=(TextView)findViewById(R.id.dering_f8_qes_3);
		dering_f8_qes_4=(TextView)findViewById(R.id.dering_f8_qes_4);
		dering_f8_qes_5=(TextView)findViewById(R.id.dering_f8_qes_5);
		dering_f8_qes_6=(TextView)findViewById(R.id.dering_f8_qes_6);
		dering_f8_qes_1.setOnClickListener(this);
		dering_f8_qes_2.setOnClickListener(this);
		dering_f8_qes_3.setOnClickListener(this);
		dering_f8_qes_4.setOnClickListener(this);
		dering_f8_qes_5.setOnClickListener(this);
		dering_f8_ans_username.setText(Global.username.trim());
		dering_f8_ans_username.setFocusable(false);
		dering_f8_qes_6.setOnClickListener(this);
		
		
	}



	@Override
	public void onClick(View v) 
	{
		if(v.getId()==dering_f8_qes_1.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_1);
			toast_msg();
		}
		else if(v.getId()==dering_f8_qes_2.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_2);
			toast_msg();
		}
		else if(v.getId()==dering_f8_qes_3.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_3);
			toast_msg();
		}
		else if(v.getId()==dering_f8_qes_4.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_4);
			toast_msg();
		}
		else if(v.getId()==dering_f8_qes_5.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_5);
			toast_msg();
		}
		else if(v.getId()==dering_f8_qes_6.getId())
		{
			value=getResources().getString(R.string.dering_f8_qes_6);
			toast_msg();
		}
		
	}
	
	public void toast_msg()
	{
		LayoutInflater inflater = getLayoutInflater();

		View layout = inflater.inflate(R.layout.custom_toast,
				(ViewGroup) findViewById(R.id.custom_toast_layout_id));
		TextView text = (TextView) layout.findViewById(R.id.text);
		text.setText(value);
		Toast toast = new Toast(getApplicationContext());
		toast.setGravity(Gravity.CENTER_VERTICAL, 0, 0);
		toast.setDuration(Toast.LENGTH_LONG);
		toast.setView(layout);
		toast.show();
	}
	

	@Override
	protected void onPause() {
		// TODO Auto-generated method stub
		super.onPause();
		SharedPreferences preferences=getSharedPreferences("dering_f8_details",MODE_PRIVATE);
		SharedPreferences.Editor editor=preferences.edit();
		editor.putString("8_username",Global.username.trim());
		editor.putString("8_date",dering_f8_ans_date.getText().toString().trim());
		editor.putString("8_lat",dering_f8_ans_lan.getText().toString().trim());
		editor.putString("8_lng",dering_f8_ans_long.getText().toString().trim());
		editor.putString("8_phone", dering_f8_ans_phone.getText().toString().trim());
		editor.putString("8_responden",dering_f8_ans_responden.getText().toString().trim());
		editor.commit();
	}

	@Override
	protected void onResume() 
	{
		// TODO Auto-generated method stub
		super.onResume();

		SharedPreferences preferences=getSharedPreferences("dering_f8_details",MODE_PRIVATE);
		dering_f8_ans_username.setText(Global.username.trim());
		dering_f8_ans_date.setText(Global.date);
		dering_f8_ans_lan.setText(preferences.getString("8_lat", "none"));
		dering_f8_ans_long.setText(preferences.getString("8_lng", "none"));
		dering_f8_ans_phone.setText(preferences.getString("8_phone", "none"));
		dering_f8_ans_responden.setText(preferences.getString("8_responden", "none"));
	}
	
	public void senddetails()
	{
		 boolean answer;
	        answer=isOnline();
        if(answer)
        {
		SharedPreferences preferences1a=getSharedPreferences("dering_f1_details",MODE_PRIVATE);
		f1_1=preferences1a.getString("1_1","none");
		f1_2=preferences1a.getString("1_2","none");
		f1_3=preferences1a.getString("1_3","none");
		f1_4=preferences1a.getString("1_4","none");
		f1_5=preferences1a.getString("1_5","none");
		f1_6=preferences1a.getString("1_6","none");
		f1_7=preferences1a.getString("1_7","none");
		try
		{
		f1_5=URLEncoder.encode(f1_5,"UTF-8");
		f1_6=URLEncoder.encode(f1_6,"UTF-8");
		f1_7=URLEncoder.encode(f1_7,"UTF-8");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		SharedPreferences preferences2a=getSharedPreferences("dering_f2_details",MODE_PRIVATE);
		f2_1=preferences2a.getString("2_1", "none");
		f2_2=preferences2a.getString("2_2", "none");
		f2_3=preferences2a.getString("2_3", "none");
		f2_4=preferences2a.getString("2_4", "none");
		f2_5=preferences2a.getString("2_5", "none");
		f2_6a=preferences2a.getString("2_6a", "none");
		f2_6b=preferences2a.getString("2_6b", "none");
		try
		{
		f2_1=URLEncoder.encode(f2_1,"UTF-8");
		f2_2=URLEncoder.encode(f2_2,"UTF-8");
		f2_3=URLEncoder.encode(f2_3,"UTF-8");
		f2_4=URLEncoder.encode(f2_4,"UTF-8");
		f2_5=URLEncoder.encode(f2_5,"UTF-8");
		f2_6a=URLEncoder.encode(f2_6a,"UTF-8");
		f2_6b=URLEncoder.encode(f2_6b,"UTF-8");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		SharedPreferences preferences3a=getSharedPreferences("dering_f3_details",MODE_PRIVATE);
		f3_1a=preferences3a.getString("3_1a","none");
		f3_1b=preferences3a.getString("3_1b","none");
		f3_2a1a=preferences3a.getString("3_2a1a","none");
		f3_2a1a1=preferences3a.getString("3_2a1a1","none");
		f3_2a1a2=preferences3a.getString("3_2a1a2","none");
		f3_2a1a3=preferences3a.getString("3_2a1a3","none");
		f3_2a1a4=preferences3a.getString("3_2a1a4","none");
		f3_2a1b=preferences3a.getString("3_2a1b","none");
		f3_2a1b1=preferences3a.getString("3_2a1b1","none");
		f3_2a1b2=preferences3a.getString("3_2a1b2","none");
		f3_2a1b3=preferences3a.getString("3_2a1b3","none");
		f3_2a1b4=preferences3a.getString("3_2a1b4","none");
		f3_2a2a1=preferences3a.getString("3_2a2a1","none");
		f3_2a2a2=preferences3a.getString("3_2a2a2","none");
		f3_2a2a3=preferences3a.getString("3_2a2a3","none");
		f3_2a2a4=preferences3a.getString("3_2a2a4","none");
		f3_2a2b1=preferences3a.getString("3_2a2b1","none");
		f3_2a2b2=preferences3a.getString("3_2a2b2","none");
		f3_2a2b3=preferences3a.getString("3_2a2b3","none");
		f3_2a2b4=preferences3a.getString("3_2a2b4","none");
		f3_2a31=preferences3a.getString("3_2a31","none");
		f3_2a32=preferences3a.getString("3_2a32","none");
		f3_2a33=preferences3a.getString("3_2a33","none");
		f3_2a34=preferences3a.getString("3_2a34","none");
		f3_2a41=preferences3a.getString("3_2a41","none");
		f3_2a42=preferences3a.getString("3_2a42","none");
		f3_2a43=preferences3a.getString("3_2a43","none");
		f3_2a44=preferences3a.getString("3_2a44","none");
		f3_2a51=preferences3a.getString("3_2a51","none");
		f3_2a52=preferences3a.getString("3_2a52","none");
		f3_2a53=preferences3a.getString("3_2a53","none");
		f3_2a54=preferences3a.getString("3_2a54","none");
		f3_2a61=preferences3a.getString("3_2a61","none");
		f3_2a62=preferences3a.getString("3_2a62","none");
		f3_2a63=preferences3a.getString("3_2a63","none");
		f3_2a64=preferences3a.getString("3_2a64","none");
		f3_2a71=preferences3a.getString("3_2a71","none");
		f3_2a72=preferences3a.getString("3_2a72","none");
		f3_2a73=preferences3a.getString("3_2a73","none");
		f3_2a74=preferences3a.getString("3_2a74","none");
		f3_2a81=preferences3a.getString("3_2a81","none");
		f3_2a82=preferences3a.getString("3_2a82","none");
		f3_2a83=preferences3a.getString("3_2a83","none");
		f3_2a84=preferences3a.getString("3_2a84","none");
		f3_2a91=preferences3a.getString("3_2a91","none");
		f3_2a92=preferences3a.getString("3_2a92","none");
		f3_2a93=preferences3a.getString("3_2a93","none");
		f3_2a94=preferences3a.getString("3_2a94","none");
		f3_2b1a1=preferences3a.getString("3_2b1a1","none");
		f3_2b1a2=preferences3a.getString("3_2b1a2","none");
		f3_2b1a3=preferences3a.getString("3_2b1a3","none");
		f3_2b1a4=preferences3a.getString("3_2b1a4","none");
		f3_2b1b1=preferences3a.getString("3_2b1b1","none");
		f3_2b1b2=preferences3a.getString("3_2b1b2","none");
		f3_2b1b3=preferences3a.getString("3_2b1b3","none");
		f3_2b1b4=preferences3a.getString("3_2b1b4","none");
		f3_2b21=preferences3a.getString("3_2b21","none");
		f3_2b22=preferences3a.getString("3_2b22","none");
		f3_2b23=preferences3a.getString("3_2b23","none");
		f3_2b24=preferences3a.getString("3_2b24","none");
		f3_2b31=preferences3a.getString("3_2b31","none");
		f3_2b32=preferences3a.getString("3_2b32","none");
		f3_2b33=preferences3a.getString("3_2b33","none");
		f3_2b34=preferences3a.getString("3_2b34","none");
		f3_2b41=preferences3a.getString("3_2b41","none");
		f3_2b42=preferences3a.getString("3_2b42","none");
		f3_2b43=preferences3a.getString("3_2b43","none");
		f3_2b44=preferences3a.getString("3_2b44","none");
		f3_2b51=preferences3a.getString("3_2b51","none");
		f3_2b52=preferences3a.getString("3_2b52","none");
		f3_2b53=preferences3a.getString("3_2b53","none");
		f3_2b54=preferences3a.getString("3_2b54","none");
		f3_2b61=preferences3a.getString("3_2b61","none");
		f3_2b62=preferences3a.getString("3_2b62","none");
		f3_2b63=preferences3a.getString("3_2b63","none");
		f3_2b64=preferences3a.getString("3_2b64","none");
		f3_3=preferences3a.getString("3_3","none");
		f3_4=preferences3a.getString("3_4","none");
		f3_5a=preferences3a.getString("3_5a","none");
		f3_5b=preferences3a.getString("3_5b","none");
		f3_5c=preferences3a.getString("3_5c","none");
		f3_5d=preferences3a.getString("3_5d","none");
		try{
		f3_1a=URLEncoder.encode(f3_1a,"UTF-8");
		f3_1b=URLEncoder.encode(f3_1b,"UTF-8");
		f3_2a1a=URLEncoder.encode(f3_2a1a,"UTF-8");
		f3_2a1a1=URLEncoder.encode(f3_2a1a1,"UTF-8");
		f3_2a1a2=URLEncoder.encode(f3_2a1a2,"UTF-8");
		f3_2a1a3=URLEncoder.encode(f3_2a1a3,"UTF-8");
		f3_2a1a4=URLEncoder.encode(f3_2a1a4,"UTF-8");
		f3_2a1b=URLEncoder.encode(f3_2a1b,"UTF-8");
		f3_2a1b1=URLEncoder.encode(f3_2a1b1,"UTF-8");
		f3_2a1b2=URLEncoder.encode(f3_2a1b2,"UTF-8");
		f3_2a1b3=URLEncoder.encode(f3_2a1b3,"UTF-8");
		f3_2a1b4=URLEncoder.encode(f3_2a1b4,"UTF-8");
		f3_2a2a1=URLEncoder.encode(f3_2a2a1,"UTF-8");
		f3_2a2a2=URLEncoder.encode(f3_2a2a2,"UTF-8");
		f3_2a2a3=URLEncoder.encode(f3_2a2a3,"UTF-8");
		f3_2a2a4=URLEncoder.encode(f3_2a2a4,"UTF-8");
		f3_2a2b1=URLEncoder.encode(f3_2a2b1,"UTF-8");
		f3_2a2b2=URLEncoder.encode(f3_2a2b2,"UTF-8");
		f3_2a2b3=URLEncoder.encode(f3_2a2b3,"UTF-8");
		f3_2a2b4=URLEncoder.encode(f3_2a2b4,"UTF-8");
		f3_2a31=URLEncoder.encode(f3_2a31,"UTF-8");
		f3_2a32=URLEncoder.encode(f3_2a32,"UTF-8");
		f3_2a33=URLEncoder.encode(f3_2a33,"UTF-8");
		f3_2a34=URLEncoder.encode(f3_2a34,"UTF-8");
		f3_2a41=URLEncoder.encode(f3_2a41,"UTF-8");
		f3_2a42=URLEncoder.encode(f3_2a42,"UTF-8");
		f3_2a43=URLEncoder.encode(f3_2a43,"UTF-8");
		f3_2a44=URLEncoder.encode(f3_2a44,"UTF-8");
		f3_2a51=URLEncoder.encode(f3_2a51,"UTF-8");
		f3_2a52=URLEncoder.encode(f3_2a52,"UTF-8");
		f3_2a53=URLEncoder.encode(f3_2a53,"UTF-8");
		f3_2a54=URLEncoder.encode(f3_2a54,"UTF-8");
		f3_2a61=URLEncoder.encode(f3_2a61,"UTF-8");
		f3_2a62=URLEncoder.encode(f3_2a62,"UTF-8");
		f3_2a63=URLEncoder.encode(f3_2a63,"UTF-8");
		f3_2a64=URLEncoder.encode(f3_2a64,"UTF-8");
		f3_2a71=URLEncoder.encode(f3_2a71,"UTF-8");
		f3_2a72=URLEncoder.encode(f3_2a72,"UTF-8");
		f3_2a73=URLEncoder.encode(f3_2a73,"UTF-8");
		f3_2a74=URLEncoder.encode(f3_2a74,"UTF-8");
		f3_2a81=URLEncoder.encode(f3_2a81,"UTF-8");
		f3_2a82=URLEncoder.encode(f3_2a82,"UTF-8");
		f3_2a83=URLEncoder.encode(f3_2a83,"UTF-8");
		f3_2a84=URLEncoder.encode(f3_2a84,"UTF-8");
		f3_2a91=URLEncoder.encode(f3_2a91,"UTF-8");
		f3_2a92=URLEncoder.encode(f3_2a92,"UTF-8");
		f3_2a93=URLEncoder.encode(f3_2a93,"UTF-8");
		f3_2a94=URLEncoder.encode(f3_2a94,"UTF-8");
		f3_2b1a1=URLEncoder.encode(f3_2b1a1,"UTF-8");
		f3_2b1a2=URLEncoder.encode(f3_2b1a2,"UTF-8");
		f3_2b1a3=URLEncoder.encode(f3_2b1a3,"UTF-8");
		f3_2b1a4=URLEncoder.encode(f3_2b1a4,"UTF-8");
		f3_2b1b1=URLEncoder.encode(f3_2b1b1,"UTF-8");
		f3_2b1b2=URLEncoder.encode(f3_2b1b2,"UTF-8");
		f3_2b1b3=URLEncoder.encode(f3_2b1b3,"UTF-8");
		f3_2b1b4=URLEncoder.encode(f3_2b1b4,"UTF-8");
		f3_2b21=URLEncoder.encode(f3_2b21,"UTF-8");
		f3_2b22=URLEncoder.encode(f3_2b22,"UTF-8");
		f3_2b23=URLEncoder.encode(f3_2b23,"UTF-8");
		f3_2b24=URLEncoder.encode(f3_2b24,"UTF-8");
		f3_2b31=URLEncoder.encode(f3_2b31,"UTF-8");
		f3_2b32=URLEncoder.encode(f3_2b32,"UTF-8");
		f3_2b33=URLEncoder.encode(f3_2b33,"UTF-8");
		f3_2b34=URLEncoder.encode(f3_2b34,"UTF-8");
		f3_2b41=URLEncoder.encode(f3_2b41,"UTF-8");
		f3_2b42=URLEncoder.encode(f3_2b42,"UTF-8");
		f3_2b43=URLEncoder.encode(f3_2b43,"UTF-8");
		f3_2b44=URLEncoder.encode(f3_2b44,"UTF-8");
		f3_2b51=URLEncoder.encode(f3_2b51,"UTF-8");
		f3_2b52=URLEncoder.encode(f3_2b52,"UTF-8");
		f3_2b53=URLEncoder.encode(f3_2b53,"UTF-8");
		f3_2b54=URLEncoder.encode(f3_2b54,"UTF-8");
		f3_2b61=URLEncoder.encode(f3_2b61,"UTF-8");
		f3_2b62=URLEncoder.encode(f3_2b62,"UTF-8");
		f3_2b63=URLEncoder.encode(f3_2b63,"UTF-8");
		f3_2b64=URLEncoder.encode(f3_2b64,"UTF-8");
		f3_3=URLEncoder.encode(f3_3,"UTF-8");
		f3_4=URLEncoder.encode(f3_4,"UTF-8");
		f3_5a=URLEncoder.encode(f3_5a,"UTF-8");
		f3_5b=URLEncoder.encode(f3_5b,"UTF-8");
		f3_5c=URLEncoder.encode(f3_5c,"UTF-8");
		f3_5d=URLEncoder.encode(f3_5d,"UTF-8");
		}
		catch(Exception e)
		{
			e.printStackTrace();
		}
		
		SharedPreferences preferences4a=getSharedPreferences("dering_f4_details",MODE_PRIVATE);
		f4_1=preferences4a.getString("4_1","none");
		f4_2a=preferences4a.getString("4_2a","none");
		f4_2b=preferences4a.getString("4_2b","none");
		f4_3=preferences4a.getString("4_3","none");
		f4_4=preferences4a.getString("4_4","none");
		f4_5=preferences4a.getString("4_5","none");
		f4_6=preferences4a.getString("4_6","none");
		f4_7=preferences4a.getString("4_7","none");
		f4_8=preferences4a.getString("4_8","none");
		f4_9=preferences4a.getString("4_9","none");
		f4_10a=preferences4a.getBoolean("4_10a",false);
		f4_10b=preferences4a.getBoolean("4_10b",false);
		f4_11a=preferences4a.getBoolean("4_11a",false);
		f4_11b=preferences4a.getBoolean("4_11b",false);
		f4_11c=preferences4a.getBoolean("4_11c",false);
		f4_11d=preferences4a.getBoolean("4_11d",false);
		f4_12a=preferences4a.getBoolean("4_12a",false);
		f4_12b=preferences4a.getBoolean("4_12b",false);
		f4_12c=preferences4a.getBoolean("4_12c",false);
		f4_12d=preferences4a.getBoolean("4_12d",false);
		f4_13a=preferences4a.getBoolean("4_13a",false);
		f4_13b=preferences4a.getBoolean("4_13b",false);
		f4_13c=preferences4a.getBoolean("4_13c",false);
		f4_13d=preferences4a.getBoolean("4_13d",false);
		f4_13e=preferences4a.getBoolean("4_13e",false);
		f4_13f=preferences4a.getBoolean("4_13f",false);
		f4_13g=preferences4a.getBoolean("4_13g",false);
		f4_13h=preferences4a.getBoolean("4_13h",false);
		f4_13i=preferences4a.getBoolean("4_13i",false);
		f4_13j=preferences4a.getBoolean("4_13j",false);
		f4_15a=preferences4a.getBoolean("4_15a",false);
		f4_15b=preferences4a.getBoolean("4_15b",false);
		f4_15c=preferences4a.getBoolean("4_15c",false);
		f4_15d=preferences4a.getBoolean("4_15d",false);
		f4_15e=preferences4a.getBoolean("4_15e",false);
		f4_15f=preferences4a.getBoolean("4_15f",false);
		f4_15g=preferences4a.getBoolean("4_15g",false);
		f4_15h=preferences4a.getBoolean("4_15h",false);
		f4_15i=preferences4a.getBoolean("4_15i",false);
		f4_15j=preferences4a.getBoolean("4_15j",false);
		f4_14=preferences4a.getString("4_14","none");
		f4_16=preferences4a.getString("4_16","none");
		SharedPreferences preferences5a=getSharedPreferences("dering_f5_details",MODE_PRIVATE);
		f5_1=preferences5a.getString("5_1","none");
		f5_2=preferences5a.getString("5_2","none");
		f5_3=preferences5a.getString("5_3","none");
		f5_4=preferences5a.getString("5_4","none");
		f5_5a=preferences5a.getBoolean("5_5a",false);
		f5_5b=preferences5a.getBoolean("5_5b",false);
		f5_5c=preferences5a.getBoolean("5_5c",false);
		f5_5d=preferences5a.getBoolean("5_5d",false);
		f5_6=preferences5a.getString("5_6","none");
		f5_7a=preferences5a.getBoolean("5_7a",false);
		f5_7b=preferences5a.getBoolean("5_7b",false);
		f5_8=preferences5a.getString("5_8","none");
		f5_9a=preferences5a.getBoolean("5_9a",false);
		f5_9b=preferences5a.getBoolean("5_9b",false);
		f5_9c=preferences5a.getBoolean("5_9c",false);
		f5_9d=preferences5a.getBoolean("5_9d",false);
		f5_10=preferences5a.getString("5_10","none");
		f5_11=preferences5a.getString("5_11","none");
		f5_12=preferences5a.getString("5_12","none");
		f5_13a=preferences4a.getBoolean("5_13a",false);
		f5_13b=preferences4a.getBoolean("5_13b",false);
		f5_13c=preferences4a.getBoolean("5_13c",false);
		f5_13d=preferences4a.getBoolean("5_13d",false);
		f5_13e=preferences4a.getBoolean("5_13e",false);
		f5_13f=preferences4a.getBoolean("5_13f",false);
		f5_13g=preferences4a.getBoolean("5_13g",false);
		SharedPreferences preferences6a=getSharedPreferences("dering_f6_details",MODE_PRIVATE);
		f6_1a=preferences6a.getString("6_1a","none");
		f6_1b=preferences6a.getString("6_1b","none");
		f6_2a=preferences6a.getString("6_2a","none");
		f6_2b=preferences6a.getString("6_2b","none");
		f6_3a=preferences6a.getString("6_3a","none");
		f6_3b=preferences6a.getString("6_3b","none");
		f6_4a=preferences6a.getString("6_4a","none");
		f6_4b=preferences6a.getString("6_4b","none");
		f6_5=preferences6a.getString("6_5","none");
		f6_6=preferences6a.getString("6_6","none");
		f6_7a1=preferences6a.getString("6_7a1","none");
		f6_7a2=preferences6a.getString("6_7a2","none");
		f6_7a3=preferences6a.getString("6_7a3","none");
		f6_7b1=preferences6a.getString("6_7b1","none");
		f6_7b2=preferences6a.getString("6_7b2","none");
		f6_7b3=preferences6a.getString("6_7b3","none");
		f6_7c1=preferences6a.getString("6_7c1","none");
		f6_7c2=preferences6a.getString("6_7c2","none");
		f6_7c3=preferences6a.getString("6_7c3","none");
		f6_8=preferences6a.getString("6_8","none");
		f6_91a1=preferences6a.getString("6_91a1","none");
		f6_91a2=preferences6a.getString("6_91a2","none");
		f6_91a3=preferences6a.getString("6_91a3","none");
		f6_91b1=preferences6a.getString("6_91b1","none");
		f6_91b2=preferences6a.getString("6_91b2","none");
		f6_91b3=preferences6a.getString("6_91b3","none");
		f6_91c1=preferences6a.getString("6_91c1","none");
		f6_91c2=preferences6a.getString("6_91c2","none");
		f6_91c3=preferences6a.getString("6_91c3","none");
		f6_921=preferences6a.getString("6_921","none");
		f6_922=preferences6a.getString("6_922","none");
		f6_923=preferences6a.getString("6_923","none");
		f6_931=preferences6a.getString("6_931","none");
		f6_932=preferences6a.getString("6_932","none");
		f6_933=preferences6a.getString("6_933","none");
		SharedPreferences preferences7a=getSharedPreferences("dering_f7_details",MODE_PRIVATE);
		f7_1=preferences7a.getString("7_1","none");
		f7_2a=preferences7a.getBoolean("f7_2a",false);
		f7_2b=preferences7a.getBoolean("f7_2b",false);
		f7_3a=preferences7a.getBoolean("f7_3a",false);
		f7_3b=preferences7a.getBoolean("f7_3b",false);
		f7_3c=preferences7a.getBoolean("f7_3c",false);
		f7_3d=preferences7a.getBoolean("f7_3d",false);
		f7_3e=preferences7a.getBoolean("f7_3e",false);
		f7_3f=preferences7a.getBoolean("f7_3f",false);
		try 
		{
			f7_1=URLEncoder.encode(f7_1,"UTF-8");
		} 
		catch (UnsupportedEncodingException e) 
		{
			e.printStackTrace();
		}
		SharedPreferences preferences8=getSharedPreferences("dering_f8_details",MODE_PRIVATE);
		f8_1=Global.username.trim();
		f8_2=preferences8.getString("8_date", "none");
		f8_3=preferences8.getString("8_lat", "none");
		f8_4=preferences8.getString("8_lng", "none");
		f8_5=preferences8.getString("8_phone", "none");
		f8_6=preferences8.getString("8_responden", "none");
		new upload().execute();
	        }
	        else
	        {
	        	SQLiteAdapter_Dering adapter_Dering=new SQLiteAdapter_Dering(getApplicationContext());
	        	adapter_Dering.openToWrite();
	        	adapter_Dering.insert(f1_1, f1_2, f1_3, f1_4, f1_5, f1_6, f1_7, f2_1, f2_2, f2_3, f2_4, f2_5, f2_6a, f2_6b, f3_1a, f3_1b, f3_2a1a, f3_2a1a1, f3_2a1a2, f3_2a1a3, f3_2a1a4, f3_2a1b, f3_2a1b1, f3_2a1b2, f3_2a1b3, f3_2a1b4, f3_2a2a1, f3_2a2a2, f3_2a2a3, f3_2a2a4, f3_2a2b1, f3_2a2b2, f3_2a2b3, f3_2a2b4, f3_2a31, f3_2a32, f3_2a33, f3_2a34, f3_2a41, f3_2a42, f3_2a43, f3_2a44, f3_2a51, f3_2a52, f3_2a53, f3_2a54, f3_2a61, f3_2a62, f3_2a63, f3_2a64, f3_2a71, f3_2a72, f3_2a73, f3_2a74, f3_2a81, f3_2a82, f3_2a83, f3_2a84, f3_2a91, f3_2a92, f3_2a93, f3_2a94, f3_2b1a1, f3_2b1a2, f3_2b1a3, f3_2b1a4, f3_2b1b1, f3_2b1b2, f3_2b1b3, f3_2b1b4, f3_2b21, f3_2b22, f3_2b23, f3_2b24, f3_2b31, f3_2b32, f3_2b33, f3_2b34, f3_2b41, f3_2b42, f3_2b43, f3_2b44, f3_2b51, f3_2b52, f3_2b53, f3_2b54, f3_2b61, f3_2b62, f3_2b63, f3_2b64, f3_3, f3_4, f3_5a, f3_5b, f3_5c, f3_5d, f4_1, f4_2a, f4_2b, f4_3, f4_4, f4_5, f4_6, f4_7, f4_8, f4_9, "none"+f4_10a, "none"+f4_10b, "none"+f4_11a, "none"+f4_11b, "none"+f4_11c, "none"+f4_11d, "none"+f4_12a, "none"+f4_12b, "none"+f4_12c, "none"+f4_12d, "none"+f4_13a, "none"+f4_13b, "none"+f4_13c, "none"+f4_13d, "none"+f4_13e, "none"+f4_13f, "none"+f4_13g, "none"+f4_13h, "none"+f4_13i,"none"+f4_13j, f4_14, "none"+f4_15a, "none"+f4_15b,"none"+f4_15c, "none"+f4_15d, "none"+f4_15e, "none"+f4_15f, "none"+f4_15g, "none"+f4_15h, "none"+f4_15i,"none"+f4_15j, f4_16, f5_1, f5_2, f5_3, f5_4, "none"+f5_5a, "none"+f5_5b, "none"+f5_5c, "none"+f5_5d, f5_6, "none"+f5_7a, "none"+f5_7b, f5_8, "none"+f5_9a, "none"+f5_9b, "none"+f5_9c, "none"+f5_9d, f5_10, f5_11, f5_12, "none"+f5_13a, "none"+f5_13b, "none"+f5_13c, "none"+f5_13d, "none"+f5_13e, "none"+f5_13f, "none"+f5_13g, f6_1a, f6_1b, f6_2a, f6_2b, f6_3a, f6_3b, f6_4a, f6_4b, f6_5, f6_6, f6_7a1, f6_7a2, f6_7a3, f6_7b1, f6_7b2, f6_7b3, f6_7c1, f6_7c2, f6_7c3, f6_8, f6_91a1, f6_91a2, f6_91a3, f6_91b1, f6_91b2, f6_91b3, f6_91c1, f6_91c2, f6_91c3, f6_921, f6_922, f6_923, f6_931, f6_932, f6_933, f7_1, "none"+f7_2a, "none"+f7_2b, "none"+f7_3a, "none"+f7_3b, "none"+f7_3c, "none"+f7_3d, "none"+f7_3e, "none"+f7_3f, f8_1, f8_2, f8_3, f8_4, f8_5, f8_6, "f8_7", "f8_8",Global.dering_year);
	        	adapter_Dering.close();
	        	String detail="f1_1="+f1_1+"&f1_2="+f1_2+"&f1_3="+f1_3+"&f1_4="+f1_4+"&f1_5="+f1_5+"&f1_6="+f1_6+"&f1_7="+f1_7+"&f2_1="+f2_1+"&f2_2="+f2_2+"&f2_3="+f2_3+"&f2_4="+f2_4+"&f2_5="+f2_5+"&f2_6a="+f2_6a+"&f2_6b="+f2_6b+"&f3_1a="+f3_1a+"&f3_1b="+f3_1b+"&f3_2a1a="+f3_2a1a+"&f3_2a1a1="+f3_2a1a1+"&f3_2a1a2="+f3_2a1a2+"&f3_2a1a3="+f3_2a1a3+"&f3_2a1a4="+f3_2a1a4+"&f3_2a1b="+f3_2a1b+"&f3_2a1b1="+f3_2a1b1+"&f3_2a1b2="+f3_2a1b2+"&f3_2a1b3="+f3_2a1b3+"&f3_2a1b4="+f3_2a1b4+"&f3_2a2a1="+f3_2a2a1+"&f3_2a2a2="+f3_2a2a2+"&f3_2a2a3="+f3_2a2a3+"&f3_2a2a4="+f3_2a2a4+"&f3_2a2b1="+f3_2a2b1+"&f3_2a2b2="+f3_2a2b2+"&f3_2a2b3="+f3_2a2b3+"&f3_2a2b4="+f3_2a2b4+"&f3_2a31="+f3_2a31+"&f3_2a32="+f3_2a32+"&f3_2a33="+f3_2a33+"&f3_2a34="+f3_2a34+"&f3_2a41="+f3_2a41+"&f3_2a42="+f3_2a42+"&f3_2a43="+f3_2a43+"&f3_2a44="+f3_2a44+"&f3_2a51="+f3_2a51+"&f3_2a52="+f3_2a52+"&f3_2a53="+f3_2a53+"&f3_2a54="+f3_2a54+"&f3_2a61="+f3_2a61+"&f3_2a62="+f3_2a62+"&f3_2a63="+f3_2a63+"&f3_2a64="+f3_2a64+"&f3_2a71="+f3_2a71+"&f3_2a72="+f3_2a72+"&f3_2a73="+f3_2a73+"&f3_2a74="+f3_2a74+"&f3_2a81="+f3_2a81+"&f3_2a82="+f3_2a82+"&f3_2a83="+f3_2a83+"&f3_2a84="+f3_2a84+"&f3_2a91="+f3_2a91+"&f3_2a92="+f3_2a92+"&f3_2a93="+f3_2a93+"&f3_2a94="+f3_2a94+"&f3_2b1a1="+f3_2b1a1+"&f3_2b1a2="+f3_2b1a2+"&f3_2b1a3="+f3_2b1a3+"&f3_2b1a4="+f3_2b1a4+"&f3_2b1b1="+f3_2b1b1+"&f3_2b1b2="+f3_2b1b2+"&f3_2b1b3="+f3_2b1b3+"&f3_2b1b4="+f3_2b1b4+"&f3_2b21="+f3_2b21+"&f3_2b22="+f3_2b22+"&f3_2b23="+f3_2b23+"&f3_2b24="+f3_2b24+"&f3_2b31="+f3_2b31+"&f3_2b32="+f3_2b32+"&f3_2b33="+f3_2b33+"&f3_2b34="+f3_2b34+"&f3_2b41="+f3_2b41+"&f3_2b42="+f3_2b42+"&f3_2b43="+f3_2b43+"&f3_2b44="+f3_2b44+"&f3_2b51="+f3_2b51+"&f3_2b52="+f3_2b52+"&f3_2b53="+f3_2b53+"&f3_2b54="+f3_2b54+"&f3_2b61="+f3_2b61+"&f3_2b62="+f3_2b62+"&f3_2b63="+f3_2b63+"&f3_2b64="+f3_2b64+"&f3_3="+f3_3+"&f3_4="+f3_4+"&f3_5a="+f3_5a+"&f3_5b="+f3_5b+"&f3_5c="+f3_5c+"&f3_5d="+f3_5d+"&f4_1="+f4_1+"&f4_2a="+f4_2a+"&f4_2b="+f4_2b+"&f4_3="+f4_3+"&f4_4="+f4_4+"&f4_5="+f4_5+"&f4_6="+f4_6+"&f4_7="+f4_7+"&f4_8="+f4_8+"&f4_9="+f4_9+"&f4_10a="+f4_10a+"&f4_10b="+f4_10b+"&f4_11a="+f4_11a+"&f4_11b="+f4_11b+"&f4_11c="+f4_11c+"&f4_11d="+f4_11d+"&f4_12a="+f4_12a+"&f4_12b="+f4_12b+"&f4_12c="+f4_12c+"&f4_12d="+f4_12d+"&f4_13a="+f4_13a+"&f4_13b="+f4_13b+"&f4_13c="+f4_13c+"&f4_13d="+f4_13d+"&f4_13e="+f4_13e+"&f4_13f="+f4_13f+"&f4_13g="+f4_13g+"&f4_13h="+f4_13h+"&f4_13i="+f4_13i+"&f4_13j="+f4_13j+"&f4_14="+f4_14+"&f4_15a="+f4_15a+"&f4_15b="+f4_15b+"&f4_15c="+f4_15c+"&f4_15d="+f4_15d+"&f4_15e="+f4_15e+"&f4_15f="+f4_15f+"&f4_15g="+f4_15g+"&f4_15h="+f4_15h+"&f4_15i="+f4_15i+"&f4_15j="+f4_15j+"&f4_16="+f4_16+"&f5_1="+f5_1+"&f5_2="+f5_2+"&f5_3="+f5_3+"&f5_4="+f5_4+"&f5_5a="+f5_5a+"&f5_5b="+f5_5b+"&f5_5c="+f5_5c+"&f5_5d="+f5_5d+"&f5_6="+f5_6+"&f5_7a="+f5_7a+"&f5_7b="+f5_7b+"&f5_8="+f5_8+"&f5_9a="+f5_9a+"&f5_9b="+f5_9b+"&f5_9c="+f5_9c+"&f5_9d="+f5_9d+"&f5_10="+f5_10+"&f5_11="+f5_11+"&f5_12="+f5_12+"&f5_13a="+f5_13a+"&f5_13b="+f5_13b+"&f5_13c="+f5_13c+"&f5_13d="+f5_13d+"&f5_13e="+f5_13e+"&f5_13f="+f5_13f+"&f5_13g="+f5_13g+"&f6_1a="+f6_1a+"&f6_1b="+f6_1b+"&f6_2a="+f6_2a+"&f6_2b="+f6_2b+"&f6_3a="+f6_3a+"&f6_3b="+f6_3b+"&f6_4a="+f6_4a+"&f6_4b="+f6_4b+"&f6_5="+f6_5+"&f6_6="+f6_6+"&f6_7a1="+f6_7a1+"&f6_7a2="+f6_7a2+"&f6_7a3="+f6_7a3+"&f6_7b1="+f6_7b1+"&f6_7b2="+f6_7b2+"&f6_7b3="+f6_7b3+"&f6_7c1="+f6_7c1+"&f6_7c2="+f6_7c2+"&f6_7c3="+f6_7c3+"&f6_8="+f6_8+"&f6_91a1="+f6_91a1+"&f6_91a2="+f6_91a2+"&f6_91a3="+f6_91a3+"&f6_91b1="+f6_91b1+"&f6_91b2="+f6_91b2+"&f6_91b3="+f6_91b3+"&f6_91c1="+f6_91c1+"&f6_91c2="+f6_91c2+"&f6_91c3="+f6_91c3+"&f6_921="+f6_921+"&f6_922="+f6_922+"&f6_923="+f6_923+"&f6_931="+f6_931+"&f6_932="+f6_932+"&f6_933="+f6_933+"&f7_1="+f7_1+"&f7_2a="+f7_2a+"&f7_2b="+f7_2b+"&f7_3a="+f7_3a+"&f7_3b="+f7_3b+"&f7_3c="+f7_3c+"&f7_3d="+f7_3d+"&f7_3e="+f7_3e+"&f7_3f="+f7_3f+"&f8_1="+f8_1+"&f8_2="+f8_2+"&f8_3="+f8_3+"&f8_4="+f8_4+"&f8_5="+f8_5+"&f8_6="+f8_6;
			   	Intent intent=new Intent(getApplicationContext(),SmsSendFunction1.class);
			   	intent.putExtra("detail",detail);	
				startActivity(intent);
				Dering_Pengelola_8.this.finish();
	        }
	}
	class upload extends AsyncTask
	{

		ProgressDialog pd = null;


		@Override
		protected void onPreExecute()
		{
			// TODO Auto-generated method stub
			super.onPreExecute();
			serverResponseCode=200;
			serverResponseCode1=200;
			if(!Global.image_path1.isEmpty())
        	{
       		// serverResponseCode=0;
        		 int i=doing();
        	}
        	if(!Global.image_path2.isEmpty())
        	{
       		// serverResponseCode1=0;
        		int i1=doing1();
//        		new Check().execute();
        	}

		}

		
		


		@Override
		protected Object doInBackground(Object... arg0)
		{
			if(!Global.image_path1.isEmpty())
        	{
       		// serverResponseCode=0;
        		 int i=doing();
        	}
        	if(!Global.image_path2.isEmpty())
        	{
       		// serverResponseCode1=0;
        		int i1=doing1();
//        		new Check().execute();
        	}
			return null;
		}





		@Override
		protected void onPostExecute(Object result) {
			// TODO Auto-generated method stub
			super.onPostExecute(result);
			if(serverResponseCode==200&&serverResponseCode1==200)
			{
				new Check().execute();
			}
		}
		
		
		
		}
class Check extends AsyncTask{
//
		
		private String json;
		private JSONObject jsonobject;
		private String code;
		private String msg;
		private String url;
		@Override
		protected void onPreExecute() 
		{
			super.onPreExecute();
			
			if(Global.dering_year.equalsIgnoreCase("2010"))
			{
				url=Global.dering_2010_url+f1_1+"&f1_2="+f1_2+"&f1_3="+f1_3+"&f1_4="+f1_4+"&f1_5="+f1_5+"&f1_6="+f1_6+"&f1_7="+f1_7+"&f2_1="+f2_1+"&f2_2="+f2_2+"&f2_3="+f2_3+"&f2_4="+f2_4+"&f2_5="+f2_5+"&f2_6a="+f2_6a+"&f2_6b="+f2_6b+"&f3_1a="+f3_1a+"&f3_1b="+f3_1b+"&f3_2a1a="+f3_2a1a+"&f3_2a1a1="+f3_2a1a1+"&f3_2a1a2="+f3_2a1a2+"&f3_2a1a3="+f3_2a1a3+"&f3_2a1a4="+f3_2a1a4+"&f3_2a1b="+f3_2a1b+"&f3_2a1b1="+f3_2a1b1+"&f3_2a1b2="+f3_2a1b2+"&f3_2a1b3="+f3_2a1b3+"&f3_2a1b4="+f3_2a1b4+"&f3_2a2a1="+f3_2a2a1+"&f3_2a2a2="+f3_2a2a2+"&f3_2a2a3="+f3_2a2a3+"&f3_2a2a4="+f3_2a2a4+"&f3_2a2b1="+f3_2a2b1+"&f3_2a2b2="+f3_2a2b2+"&f3_2a2b3="+f3_2a2b3+"&f3_2a2b4="+f3_2a2b4+"&f3_2a31="+f3_2a31+"&f3_2a32="+f3_2a32+"&f3_2a33="+f3_2a33+"&f3_2a34="+f3_2a34+"&f3_2a41="+f3_2a41+"&f3_2a42="+f3_2a42+"&f3_2a43="+f3_2a43+"&f3_2a44="+f3_2a44+"&f3_2a51="+f3_2a51+"&f3_2a52="+f3_2a52+"&f3_2a53="+f3_2a53+"&f3_2a54="+f3_2a54+"&f3_2a61="+f3_2a61+"&f3_2a62="+f3_2a62+"&f3_2a63="+f3_2a63+"&f3_2a64="+f3_2a64+"&f3_2a71="+f3_2a71+"&f3_2a72="+f3_2a72+"&f3_2a73="+f3_2a73+"&f3_2a74="+f3_2a74+"&f3_2a81="+f3_2a81+"&f3_2a82="+f3_2a82+"&f3_2a83="+f3_2a83+"&f3_2a84="+f3_2a84+"&f3_2a91="+f3_2a91+"&f3_2a92="+f3_2a92+"&f3_2a93="+f3_2a93+"&f3_2a94="+f3_2a94+"&f3_2b1a1="+f3_2b1a1+"&f3_2b1a2="+f3_2b1a2+"&f3_2b1a3="+f3_2b1a3+"&f3_2b1a4="+f3_2b1a4+"&f3_2b1b1="+f3_2b1b1+"&f3_2b1b2="+f3_2b1b2+"&f3_2b1b3="+f3_2b1b3+"&f3_2b1b4="+f3_2b1b4+"&f3_2b21="+f3_2b21+"&f3_2b22="+f3_2b22+"&f3_2b23="+f3_2b23+"&f3_2b24="+f3_2b24+"&f3_2b31="+f3_2b31+"&f3_2b32="+f3_2b32+"&f3_2b33="+f3_2b33+"&f3_2b34="+f3_2b34+"&f3_2b41="+f3_2b41+"&f3_2b42="+f3_2b42+"&f3_2b43="+f3_2b43+"&f3_2b44="+f3_2b44+"&f3_2b51="+f3_2b51+"&f3_2b52="+f3_2b52+"&f3_2b53="+f3_2b53+"&f3_2b54="+f3_2b54+"&f3_2b61="+f3_2b61+"&f3_2b62="+f3_2b62+"&f3_2b63="+f3_2b63+"&f3_2b64="+f3_2b64+"&f3_3="+f3_3+"&f3_4="+f3_4+"&f3_5a="+f3_5a+"&f3_5b="+f3_5b+"&f3_5c="+f3_5c+"&f3_5d="+f3_5d+"&f4_1="+f4_1+"&f4_2a="+f4_2a+"&f4_2b="+f4_2b+"&f4_3="+f4_3+"&f4_4="+f4_4+"&f4_5="+f4_5+"&f4_6="+f4_6+"&f4_7="+f4_7+"&f4_8="+f4_8+"&f4_9="+f4_9+"&f4_10a="+f4_10a+"&f4_10b="+f4_10b+"&f4_11a="+f4_11a+"&f4_11b="+f4_11b+"&f4_11c="+f4_11c+"&f4_11d="+f4_11d+"&f4_12a="+f4_12a+"&f4_12b="+f4_12b+"&f4_12c="+f4_12c+"&f4_12d="+f4_12d+"&f4_13a="+f4_13a+"&f4_13b="+f4_13b+"&f4_13c="+f4_13c+"&f4_13d="+f4_13d+"&f4_13e="+f4_13e+"&f4_13f="+f4_13f+"&f4_13g="+f4_13g+"&f4_13h="+f4_13h+"&f4_13i="+f4_13i+"&f4_13j="+f4_13j+"&f4_14="+f4_14+"&f4_15a="+f4_15a+"&f4_15b="+f4_15b+"&f4_15c="+f4_15c+"&f4_15d="+f4_15d+"&f4_15e="+f4_15e+"&f4_15f="+f4_15f+"&f4_15g="+f4_15g+"&f4_15h="+f4_15h+"&f4_15i="+f4_15i+"&f4_15j="+f4_15j+"&f4_16="+f4_16+"&f5_1="+f5_1+"&f5_2="+f5_2+"&f5_3="+f5_3+"&f5_4="+f5_4+"&f5_5a="+f5_5a+"&f5_5b="+f5_5b+"&f5_5c="+f5_5c+"&f5_5d="+f5_5d+"&f5_6="+f5_6+"&f5_7a="+f5_7a+"&f5_7b="+f5_7b+"&f5_8="+f5_8+"&f5_9a="+f5_9a+"&f5_9b="+f5_9b+"&f5_9c="+f5_9c+"&f5_9d="+f5_9d+"&f5_10="+f5_10+"&f5_11="+f5_11+"&f5_12="+f5_12+"&f5_13a="+f5_13a+"&f5_13b="+f5_13b+"&f5_13c="+f5_13c+"&f5_13d="+f5_13d+"&f5_13e="+f5_13e+"&f5_13f="+f5_13f+"&f5_13g="+f5_13g+"&f6_1a="+f6_1a+"&f6_1b="+f6_1b+"&f6_2a="+f6_2a+"&f6_2b="+f6_2b+"&f6_3a="+f6_3a+"&f6_3b="+f6_3b+"&f6_4a="+f6_4a+"&f6_4b="+f6_4b+"&f6_5="+f6_5+"&f6_6="+f6_6+"&f6_7a1="+f6_7a1+"&f6_7a2="+f6_7a2+"&f6_7a3="+f6_7a3+"&f6_7b1="+f6_7b1+"&f6_7b2="+f6_7b2+"&f6_7b3="+f6_7b3+"&f6_7c1="+f6_7c1+"&f6_7c2="+f6_7c2+"&f6_7c3="+f6_7c3+"&f6_8="+f6_8+"&f6_91a1="+f6_91a1+"&f6_91a2="+f6_91a2+"&f6_91a3="+f6_91a3+"&f6_91b1="+f6_91b1+"&f6_91b2="+f6_91b2+"&f6_91b3="+f6_91b3+"&f6_91c1="+f6_91c1+"&f6_91c2="+f6_91c2+"&f6_91c3="+f6_91c3+"&f6_921="+f6_921+"&f6_922="+f6_922+"&f6_923="+f6_923+"&f6_931="+f6_931+"&f6_932="+f6_932+"&f6_933="+f6_933+"&f7_1="+f7_1+"&f7_2a="+f7_2a+"&f7_2b="+f7_2b+"&f7_3a="+f7_3a+"&f7_3b="+f7_3b+"&f7_3c="+f7_3c+"&f7_3d="+f7_3d+"&f7_3e="+f7_3e+"&f7_3f="+f7_3f+"&f8_1="+f8_1+"&f8_2="+f8_2+"&f8_3="+f8_3+"&f8_4="+f8_4+"&f8_5="+f8_5+"&f8_6="+f8_6+"&f8_7="+"none"+"&f8_8="+"none";
				url=url.replace("+", "%2B");
				url=url.replace(" ", "%20");
				System.out.println(url);
			}
			else if(Global.dering_year.equalsIgnoreCase("2011"))
			{
				url=Global.dering_2011_url+f1_1+"&f1_2="+f1_2+"&f1_3="+f1_3+"&f1_4="+f1_4+"&f1_5="+f1_5+"&f1_6="+f1_6+"&f1_7="+f1_7+"&f2_1="+f2_1+"&f2_2="+f2_2+"&f2_3="+f2_3+"&f2_4="+f2_4+"&f2_5="+f2_5+"&f2_6a="+f2_6a+"&f2_6b="+f2_6b+"&f3_1a="+f3_1a+"&f3_1b="+f3_1b+"&f3_2a1a="+f3_2a1a+"&f3_2a1a1="+f3_2a1a1+"&f3_2a1a2="+f3_2a1a2+"&f3_2a1a3="+f3_2a1a3+"&f3_2a1a4="+f3_2a1a4+"&f3_2a1b="+f3_2a1b+"&f3_2a1b1="+f3_2a1b1+"&f3_2a1b2="+f3_2a1b2+"&f3_2a1b3="+f3_2a1b3+"&f3_2a1b4="+f3_2a1b4+"&f3_2a2a1="+f3_2a2a1+"&f3_2a2a2="+f3_2a2a2+"&f3_2a2a3="+f3_2a2a3+"&f3_2a2a4="+f3_2a2a4+"&f3_2a2b1="+f3_2a2b1+"&f3_2a2b2="+f3_2a2b2+"&f3_2a2b3="+f3_2a2b3+"&f3_2a2b4="+f3_2a2b4+"&f3_2a31="+f3_2a31+"&f3_2a32="+f3_2a32+"&f3_2a33="+f3_2a33+"&f3_2a34="+f3_2a34+"&f3_2a41="+f3_2a41+"&f3_2a42="+f3_2a42+"&f3_2a43="+f3_2a43+"&f3_2a44="+f3_2a44+"&f3_2a51="+f3_2a51+"&f3_2a52="+f3_2a52+"&f3_2a53="+f3_2a53+"&f3_2a54="+f3_2a54+"&f3_2a61="+f3_2a61+"&f3_2a62="+f3_2a62+"&f3_2a63="+f3_2a63+"&f3_2a64="+f3_2a64+"&f3_2a71="+f3_2a71+"&f3_2a72="+f3_2a72+"&f3_2a73="+f3_2a73+"&f3_2a74="+f3_2a74+"&f3_2a81="+f3_2a81+"&f3_2a82="+f3_2a82+"&f3_2a83="+f3_2a83+"&f3_2a84="+f3_2a84+"&f3_2a91="+f3_2a91+"&f3_2a92="+f3_2a92+"&f3_2a93="+f3_2a93+"&f3_2a94="+f3_2a94+"&f3_2b1a1="+f3_2b1a1+"&f3_2b1a2="+f3_2b1a2+"&f3_2b1a3="+f3_2b1a3+"&f3_2b1a4="+f3_2b1a4+"&f3_2b1b1="+f3_2b1b1+"&f3_2b1b2="+f3_2b1b2+"&f3_2b1b3="+f3_2b1b3+"&f3_2b1b4="+f3_2b1b4+"&f3_2b21="+f3_2b21+"&f3_2b22="+f3_2b22+"&f3_2b23="+f3_2b23+"&f3_2b24="+f3_2b24+"&f3_2b31="+f3_2b31+"&f3_2b32="+f3_2b32+"&f3_2b33="+f3_2b33+"&f3_2b34="+f3_2b34+"&f3_2b41="+f3_2b41+"&f3_2b42="+f3_2b42+"&f3_2b43="+f3_2b43+"&f3_2b44="+f3_2b44+"&f3_2b51="+f3_2b51+"&f3_2b52="+f3_2b52+"&f3_2b53="+f3_2b53+"&f3_2b54="+f3_2b54+"&f3_2b61="+f3_2b61+"&f3_2b62="+f3_2b62+"&f3_2b63="+f3_2b63+"&f3_2b64="+f3_2b64+"&f3_3="+f3_3+"&f3_4="+f3_4+"&f3_5a="+f3_5a+"&f3_5b="+f3_5b+"&f3_5c="+f3_5c+"&f3_5d="+f3_5d+"&f4_1="+f4_1+"&f4_2a="+f4_2a+"&f4_2b="+f4_2b+"&f4_3="+f4_3+"&f4_4="+f4_4+"&f4_5="+f4_5+"&f4_6="+f4_6+"&f4_7="+f4_7+"&f4_8="+f4_8+"&f4_9="+f4_9+"&f4_10a="+f4_10a+"&f4_10b="+f4_10b+"&f4_11a="+f4_11a+"&f4_11b="+f4_11b+"&f4_11c="+f4_11c+"&f4_11d="+f4_11d+"&f4_12a="+f4_12a+"&f4_12b="+f4_12b+"&f4_12c="+f4_12c+"&f4_12d="+f4_12d+"&f4_13a="+f4_13a+"&f4_13b="+f4_13b+"&f4_13c="+f4_13c+"&f4_13d="+f4_13d+"&f4_13e="+f4_13e+"&f4_13f="+f4_13f+"&f4_13g="+f4_13g+"&f4_13h="+f4_13h+"&f4_13i="+f4_13i+"&f4_13j="+f4_13j+"&f4_14="+f4_14+"&f4_15a="+f4_15a+"&f4_15b="+f4_15b+"&f4_15c="+f4_15c+"&f4_15d="+f4_15d+"&f4_15e="+f4_15e+"&f4_15f="+f4_15f+"&f4_15g="+f4_15g+"&f4_15h="+f4_15h+"&f4_15i="+f4_15i+"&f4_15j="+f4_15j+"&f4_16="+f4_16+"&f5_1="+f5_1+"&f5_2="+f5_2+"&f5_3="+f5_3+"&f5_4="+f5_4+"&f5_5a="+f5_5a+"&f5_5b="+f5_5b+"&f5_5c="+f5_5c+"&f5_5d="+f5_5d+"&f5_6="+f5_6+"&f5_7a="+f5_7a+"&f5_7b="+f5_7b+"&f5_8="+f5_8+"&f5_9a="+f5_9a+"&f5_9b="+f5_9b+"&f5_9c="+f5_9c+"&f5_9d="+f5_9d+"&f5_10="+f5_10+"&f5_11="+f5_11+"&f5_12="+f5_12+"&f5_13a="+f5_13a+"&f5_13b="+f5_13b+"&f5_13c="+f5_13c+"&f5_13d="+f5_13d+"&f5_13e="+f5_13e+"&f5_13f="+f5_13f+"&f5_13g="+f5_13g+"&f6_1a="+f6_1a+"&f6_1b="+f6_1b+"&f6_2a="+f6_2a+"&f6_2b="+f6_2b+"&f6_3a="+f6_3a+"&f6_3b="+f6_3b+"&f6_4a="+f6_4a+"&f6_4b="+f6_4b+"&f6_5="+f6_5+"&f6_6="+f6_6+"&f6_7a1="+f6_7a1+"&f6_7a2="+f6_7a2+"&f6_7a3="+f6_7a3+"&f6_7b1="+f6_7b1+"&f6_7b2="+f6_7b2+"&f6_7b3="+f6_7b3+"&f6_7c1="+f6_7c1+"&f6_7c2="+f6_7c2+"&f6_7c3="+f6_7c3+"&f6_8="+f6_8+"&f6_91a1="+f6_91a1+"&f6_91a2="+f6_91a2+"&f6_91a3="+f6_91a3+"&f6_91b1="+f6_91b1+"&f6_91b2="+f6_91b2+"&f6_91b3="+f6_91b3+"&f6_91c1="+f6_91c1+"&f6_91c2="+f6_91c2+"&f6_91c3="+f6_91c3+"&f6_921="+f6_921+"&f6_922="+f6_922+"&f6_923="+f6_923+"&f6_931="+f6_931+"&f6_932="+f6_932+"&f6_933="+f6_933+"&f7_1="+f7_1+"&f7_2a="+f7_2a+"&f7_2b="+f7_2b+"&f7_3a="+f7_3a+"&f7_3b="+f7_3b+"&f7_3c="+f7_3c+"&f7_3d="+f7_3d+"&f7_3e="+f7_3e+"&f7_3f="+f7_3f+"&f8_1="+f8_1+"&f8_2="+f8_2+"&f8_3="+f8_3+"&f8_4="+f8_4+"&f8_5="+f8_5+"&f8_6="+f8_6+"&f8_7="+"none"+"&f8_8="+"none";
				url=url.replace("+", "%2B");
				url=url.replace(" ", "%20");
				System.out.println(url);
			}
			else if(Global.dering_year.equalsIgnoreCase("2012"))
			{
				url=Global.dering_2012_url+f1_1+"&f1_2="+f1_2+"&f1_3="+f1_3+"&f1_4="+f1_4+"&f1_5="+f1_5+"&f1_6="+f1_6+"&f1_7="+f1_7+"&f2_1="+f2_1+"&f2_2="+f2_2+"&f2_3="+f2_3+"&f2_4="+f2_4+"&f2_5="+f2_5+"&f2_6a="+f2_6a+"&f2_6b="+f2_6b+"&f3_1a="+f3_1a+"&f3_1b="+f3_1b+"&f3_2a1a="+f3_2a1a+"&f3_2a1a1="+f3_2a1a1+"&f3_2a1a2="+f3_2a1a2+"&f3_2a1a3="+f3_2a1a3+"&f3_2a1a4="+f3_2a1a4+"&f3_2a1b="+f3_2a1b+"&f3_2a1b1="+f3_2a1b1+"&f3_2a1b2="+f3_2a1b2+"&f3_2a1b3="+f3_2a1b3+"&f3_2a1b4="+f3_2a1b4+"&f3_2a2a1="+f3_2a2a1+"&f3_2a2a2="+f3_2a2a2+"&f3_2a2a3="+f3_2a2a3+"&f3_2a2a4="+f3_2a2a4+"&f3_2a2b1="+f3_2a2b1+"&f3_2a2b2="+f3_2a2b2+"&f3_2a2b3="+f3_2a2b3+"&f3_2a2b4="+f3_2a2b4+"&f3_2a31="+f3_2a31+"&f3_2a32="+f3_2a32+"&f3_2a33="+f3_2a33+"&f3_2a34="+f3_2a34+"&f3_2a41="+f3_2a41+"&f3_2a42="+f3_2a42+"&f3_2a43="+f3_2a43+"&f3_2a44="+f3_2a44+"&f3_2a51="+f3_2a51+"&f3_2a52="+f3_2a52+"&f3_2a53="+f3_2a53+"&f3_2a54="+f3_2a54+"&f3_2a61="+f3_2a61+"&f3_2a62="+f3_2a62+"&f3_2a63="+f3_2a63+"&f3_2a64="+f3_2a64+"&f3_2a71="+f3_2a71+"&f3_2a72="+f3_2a72+"&f3_2a73="+f3_2a73+"&f3_2a74="+f3_2a74+"&f3_2a81="+f3_2a81+"&f3_2a82="+f3_2a82+"&f3_2a83="+f3_2a83+"&f3_2a84="+f3_2a84+"&f3_2a91="+f3_2a91+"&f3_2a92="+f3_2a92+"&f3_2a93="+f3_2a93+"&f3_2a94="+f3_2a94+"&f3_2b1a1="+f3_2b1a1+"&f3_2b1a2="+f3_2b1a2+"&f3_2b1a3="+f3_2b1a3+"&f3_2b1a4="+f3_2b1a4+"&f3_2b1b1="+f3_2b1b1+"&f3_2b1b2="+f3_2b1b2+"&f3_2b1b3="+f3_2b1b3+"&f3_2b1b4="+f3_2b1b4+"&f3_2b21="+f3_2b21+"&f3_2b22="+f3_2b22+"&f3_2b23="+f3_2b23+"&f3_2b24="+f3_2b24+"&f3_2b31="+f3_2b31+"&f3_2b32="+f3_2b32+"&f3_2b33="+f3_2b33+"&f3_2b34="+f3_2b34+"&f3_2b41="+f3_2b41+"&f3_2b42="+f3_2b42+"&f3_2b43="+f3_2b43+"&f3_2b44="+f3_2b44+"&f3_2b51="+f3_2b51+"&f3_2b52="+f3_2b52+"&f3_2b53="+f3_2b53+"&f3_2b54="+f3_2b54+"&f3_2b61="+f3_2b61+"&f3_2b62="+f3_2b62+"&f3_2b63="+f3_2b63+"&f3_2b64="+f3_2b64+"&f3_3="+f3_3+"&f3_4="+f3_4+"&f3_5a="+f3_5a+"&f3_5b="+f3_5b+"&f3_5c="+f3_5c+"&f3_5d="+f3_5d+"&f4_1="+f4_1+"&f4_2a="+f4_2a+"&f4_2b="+f4_2b+"&f4_3="+f4_3+"&f4_4="+f4_4+"&f4_5="+f4_5+"&f4_6="+f4_6+"&f4_7="+f4_7+"&f4_8="+f4_8+"&f4_9="+f4_9+"&f4_10a="+f4_10a+"&f4_10b="+f4_10b+"&f4_11a="+f4_11a+"&f4_11b="+f4_11b+"&f4_11c="+f4_11c+"&f4_11d="+f4_11d+"&f4_12a="+f4_12a+"&f4_12b="+f4_12b+"&f4_12c="+f4_12c+"&f4_12d="+f4_12d+"&f4_13a="+f4_13a+"&f4_13b="+f4_13b+"&f4_13c="+f4_13c+"&f4_13d="+f4_13d+"&f4_13e="+f4_13e+"&f4_13f="+f4_13f+"&f4_13g="+f4_13g+"&f4_13h="+f4_13h+"&f4_13i="+f4_13i+"&f4_13j="+f4_13j+"&f4_14="+f4_14+"&f4_15a="+f4_15a+"&f4_15b="+f4_15b+"&f4_15c="+f4_15c+"&f4_15d="+f4_15d+"&f4_15e="+f4_15e+"&f4_15f="+f4_15f+"&f4_15g="+f4_15g+"&f4_15h="+f4_15h+"&f4_15i="+f4_15i+"&f4_15j="+f4_15j+"&f4_16="+f4_16+"&f5_1="+f5_1+"&f5_2="+f5_2+"&f5_3="+f5_3+"&f5_4="+f5_4+"&f5_5a="+f5_5a+"&f5_5b="+f5_5b+"&f5_5c="+f5_5c+"&f5_5d="+f5_5d+"&f5_6="+f5_6+"&f5_7a="+f5_7a+"&f5_7b="+f5_7b+"&f5_8="+f5_8+"&f5_9a="+f5_9a+"&f5_9b="+f5_9b+"&f5_9c="+f5_9c+"&f5_9d="+f5_9d+"&f5_10="+f5_10+"&f5_11="+f5_11+"&f5_12="+f5_12+"&f5_13a="+f5_13a+"&f5_13b="+f5_13b+"&f5_13c="+f5_13c+"&f5_13d="+f5_13d+"&f5_13e="+f5_13e+"&f5_13f="+f5_13f+"&f5_13g="+f5_13g+"&f6_1a="+f6_1a+"&f6_1b="+f6_1b+"&f6_2a="+f6_2a+"&f6_2b="+f6_2b+"&f6_3a="+f6_3a+"&f6_3b="+f6_3b+"&f6_4a="+f6_4a+"&f6_4b="+f6_4b+"&f6_5="+f6_5+"&f6_6="+f6_6+"&f6_7a1="+f6_7a1+"&f6_7a2="+f6_7a2+"&f6_7a3="+f6_7a3+"&f6_7b1="+f6_7b1+"&f6_7b2="+f6_7b2+"&f6_7b3="+f6_7b3+"&f6_7c1="+f6_7c1+"&f6_7c2="+f6_7c2+"&f6_7c3="+f6_7c3+"&f6_8="+f6_8+"&f6_91a1="+f6_91a1+"&f6_91a2="+f6_91a2+"&f6_91a3="+f6_91a3+"&f6_91b1="+f6_91b1+"&f6_91b2="+f6_91b2+"&f6_91b3="+f6_91b3+"&f6_91c1="+f6_91c1+"&f6_91c2="+f6_91c2+"&f6_91c3="+f6_91c3+"&f6_921="+f6_921+"&f6_922="+f6_922+"&f6_923="+f6_923+"&f6_931="+f6_931+"&f6_932="+f6_932+"&f6_933="+f6_933+"&f7_1="+f7_1+"&f7_2a="+f7_2a+"&f7_2b="+f7_2b+"&f7_3a="+f7_3a+"&f7_3b="+f7_3b+"&f7_3c="+f7_3c+"&f7_3d="+f7_3d+"&f7_3e="+f7_3e+"&f7_3f="+f7_3f+"&f8_1="+f8_1+"&f8_2="+f8_2+"&f8_3="+f8_3+"&f8_4="+f8_4+"&f8_5="+f8_5+"&f8_6="+f8_6+"&f8_7="+"none"+"&f8_8="+"none";
				url=url.replace("+", "%2B");
				url=url.replace(" ", "%20");
				System.out.println(url);
			}
			else if(Global.dering_year.equalsIgnoreCase("2013"))
			{
				url=Global.dering_2013_url+f1_1+"&f1_2="+f1_2+"&f1_3="+f1_3+"&f1_4="+f1_4+"&f1_5="+f1_5+"&f1_6="+f1_6+"&f1_7="+f1_7+"&f2_1="+f2_1+"&f2_2="+f2_2+"&f2_3="+f2_3+"&f2_4="+f2_4+"&f2_5="+f2_5+"&f2_6a="+f2_6a+"&f2_6b="+f2_6b+"&f3_1a="+f3_1a+"&f3_1b="+f3_1b+"&f3_2a1a="+f3_2a1a+"&f3_2a1a1="+f3_2a1a1+"&f3_2a1a2="+f3_2a1a2+"&f3_2a1a3="+f3_2a1a3+"&f3_2a1a4="+f3_2a1a4+"&f3_2a1b="+f3_2a1b+"&f3_2a1b1="+f3_2a1b1+"&f3_2a1b2="+f3_2a1b2+"&f3_2a1b3="+f3_2a1b3+"&f3_2a1b4="+f3_2a1b4+"&f3_2a2a1="+f3_2a2a1+"&f3_2a2a2="+f3_2a2a2+"&f3_2a2a3="+f3_2a2a3+"&f3_2a2a4="+f3_2a2a4+"&f3_2a2b1="+f3_2a2b1+"&f3_2a2b2="+f3_2a2b2+"&f3_2a2b3="+f3_2a2b3+"&f3_2a2b4="+f3_2a2b4+"&f3_2a31="+f3_2a31+"&f3_2a32="+f3_2a32+"&f3_2a33="+f3_2a33+"&f3_2a34="+f3_2a34+"&f3_2a41="+f3_2a41+"&f3_2a42="+f3_2a42+"&f3_2a43="+f3_2a43+"&f3_2a44="+f3_2a44+"&f3_2a51="+f3_2a51+"&f3_2a52="+f3_2a52+"&f3_2a53="+f3_2a53+"&f3_2a54="+f3_2a54+"&f3_2a61="+f3_2a61+"&f3_2a62="+f3_2a62+"&f3_2a63="+f3_2a63+"&f3_2a64="+f3_2a64+"&f3_2a71="+f3_2a71+"&f3_2a72="+f3_2a72+"&f3_2a73="+f3_2a73+"&f3_2a74="+f3_2a74+"&f3_2a81="+f3_2a81+"&f3_2a82="+f3_2a82+"&f3_2a83="+f3_2a83+"&f3_2a84="+f3_2a84+"&f3_2a91="+f3_2a91+"&f3_2a92="+f3_2a92+"&f3_2a93="+f3_2a93+"&f3_2a94="+f3_2a94+"&f3_2b1a1="+f3_2b1a1+"&f3_2b1a2="+f3_2b1a2+"&f3_2b1a3="+f3_2b1a3+"&f3_2b1a4="+f3_2b1a4+"&f3_2b1b1="+f3_2b1b1+"&f3_2b1b2="+f3_2b1b2+"&f3_2b1b3="+f3_2b1b3+"&f3_2b1b4="+f3_2b1b4+"&f3_2b21="+f3_2b21+"&f3_2b22="+f3_2b22+"&f3_2b23="+f3_2b23+"&f3_2b24="+f3_2b24+"&f3_2b31="+f3_2b31+"&f3_2b32="+f3_2b32+"&f3_2b33="+f3_2b33+"&f3_2b34="+f3_2b34+"&f3_2b41="+f3_2b41+"&f3_2b42="+f3_2b42+"&f3_2b43="+f3_2b43+"&f3_2b44="+f3_2b44+"&f3_2b51="+f3_2b51+"&f3_2b52="+f3_2b52+"&f3_2b53="+f3_2b53+"&f3_2b54="+f3_2b54+"&f3_2b61="+f3_2b61+"&f3_2b62="+f3_2b62+"&f3_2b63="+f3_2b63+"&f3_2b64="+f3_2b64+"&f3_3="+f3_3+"&f3_4="+f3_4+"&f3_5a="+f3_5a+"&f3_5b="+f3_5b+"&f3_5c="+f3_5c+"&f3_5d="+f3_5d+"&f4_1="+f4_1+"&f4_2a="+f4_2a+"&f4_2b="+f4_2b+"&f4_3="+f4_3+"&f4_4="+f4_4+"&f4_5="+f4_5+"&f4_6="+f4_6+"&f4_7="+f4_7+"&f4_8="+f4_8+"&f4_9="+f4_9+"&f4_10a="+f4_10a+"&f4_10b="+f4_10b+"&f4_11a="+f4_11a+"&f4_11b="+f4_11b+"&f4_11c="+f4_11c+"&f4_11d="+f4_11d+"&f4_12a="+f4_12a+"&f4_12b="+f4_12b+"&f4_12c="+f4_12c+"&f4_12d="+f4_12d+"&f4_13a="+f4_13a+"&f4_13b="+f4_13b+"&f4_13c="+f4_13c+"&f4_13d="+f4_13d+"&f4_13e="+f4_13e+"&f4_13f="+f4_13f+"&f4_13g="+f4_13g+"&f4_13h="+f4_13h+"&f4_13i="+f4_13i+"&f4_13j="+f4_13j+"&f4_14="+f4_14+"&f4_15a="+f4_15a+"&f4_15b="+f4_15b+"&f4_15c="+f4_15c+"&f4_15d="+f4_15d+"&f4_15e="+f4_15e+"&f4_15f="+f4_15f+"&f4_15g="+f4_15g+"&f4_15h="+f4_15h+"&f4_15i="+f4_15i+"&f4_15j="+f4_15j+"&f4_16="+f4_16+"&f5_1="+f5_1+"&f5_2="+f5_2+"&f5_3="+f5_3+"&f5_4="+f5_4+"&f5_5a="+f5_5a+"&f5_5b="+f5_5b+"&f5_5c="+f5_5c+"&f5_5d="+f5_5d+"&f5_6="+f5_6+"&f5_7a="+f5_7a+"&f5_7b="+f5_7b+"&f5_8="+f5_8+"&f5_9a="+f5_9a+"&f5_9b="+f5_9b+"&f5_9c="+f5_9c+"&f5_9d="+f5_9d+"&f5_10="+f5_10+"&f5_11="+f5_11+"&f5_12="+f5_12+"&f5_13a="+f5_13a+"&f5_13b="+f5_13b+"&f5_13c="+f5_13c+"&f5_13d="+f5_13d+"&f5_13e="+f5_13e+"&f5_13f="+f5_13f+"&f5_13g="+f5_13g+"&f6_1a="+f6_1a+"&f6_1b="+f6_1b+"&f6_2a="+f6_2a+"&f6_2b="+f6_2b+"&f6_3a="+f6_3a+"&f6_3b="+f6_3b+"&f6_4a="+f6_4a+"&f6_4b="+f6_4b+"&f6_5="+f6_5+"&f6_6="+f6_6+"&f6_7a1="+f6_7a1+"&f6_7a2="+f6_7a2+"&f6_7a3="+f6_7a3+"&f6_7b1="+f6_7b1+"&f6_7b2="+f6_7b2+"&f6_7b3="+f6_7b3+"&f6_7c1="+f6_7c1+"&f6_7c2="+f6_7c2+"&f6_7c3="+f6_7c3+"&f6_8="+f6_8+"&f6_91a1="+f6_91a1+"&f6_91a2="+f6_91a2+"&f6_91a3="+f6_91a3+"&f6_91b1="+f6_91b1+"&f6_91b2="+f6_91b2+"&f6_91b3="+f6_91b3+"&f6_91c1="+f6_91c1+"&f6_91c2="+f6_91c2+"&f6_91c3="+f6_91c3+"&f6_921="+f6_921+"&f6_922="+f6_922+"&f6_923="+f6_923+"&f6_931="+f6_931+"&f6_932="+f6_932+"&f6_933="+f6_933+"&f7_1="+f7_1+"&f7_2a="+f7_2a+"&f7_2b="+f7_2b+"&f7_3a="+f7_3a+"&f7_3b="+f7_3b+"&f7_3c="+f7_3c+"&f7_3d="+f7_3d+"&f7_3e="+f7_3e+"&f7_3f="+f7_3f+"&f8_1="+f8_1+"&f8_2="+f8_2+"&f8_3="+f8_3+"&f8_4="+f8_4+"&f8_5="+f8_5+"&f8_6="+f8_6+"&f8_7="+"none"+"&f8_8="+"none";
				url=url.replace("+", "%2B");
				url=url.replace(" ", "%20");
				System.out.println(url);
			}
		}

		@Override
		protected Object doInBackground(Object... params) {
			
			try 
			{
				json=JSONfunctions.getStringContent(url);
				jsonobject=new JSONObject(json);
				code=jsonobject.getString("code");
				msg=jsonobject.getString("msg");
			} 
			catch (Exception e) 
			{
				e.printStackTrace();
			}
			return null;
		}
		@Override
		protected void onPostExecute(Object result)
		{
			super.onPostExecute(result);
			if(code.equalsIgnoreCase("1"))
			{
				new MailSender().execute();
			}
			else
			{
				Toast.makeText(getApplicationContext(), msg, Toast.LENGTH_SHORT).show();
			}
		}

	}

private class mylocationlistener implements LocationListener 
{

		private String la;
		private String ln;

		//	    @Override 
	    public void onLocationChanged(Location location) 
	    {    
	    	
	    
	    	if(i==0)
	    	{
	        if (location != null)
	        {
	          double lat=location.getLatitude();
	          double lng=location.getLongitude();
	          System.out.println(lat+"((("+lng);
	         la=""+lat;
	         ln=""+lng;
	        dering_f8_ans_lan.setText(la);
	        dering_f8_ans_long.setText(ln);
		       i++;  
	        }
	        }
	   
	    
	    } 

	    public void onProviderDisabled(String provider) {

	    Toast.makeText(Dering_Pengelola_8.this,"Error onProviderDisabled",Toast.LENGTH_LONG).show();

	   
	      
	        }

	    public void onProviderEnabled(String provider) {

	    Toast.makeText(Dering_Pengelola_8.this,"onProviderEnabled",Toast.LENGTH_LONG).show();

	

	    }

	    public void onStatusChanged(String provider, int status, Bundle extras) {

	    Toast.makeText(Dering_Pengelola_8.this,"onStatusChanged",Toast.LENGTH_LONG).show();


	    }
	    
	    }	

public boolean isOnline() {
    ConnectivityManager cm =
        (ConnectivityManager) getSystemService(Context.CONNECTIVITY_SERVICE);
    NetworkInfo netInfo = cm.getActiveNetworkInfo();
    if (netInfo != null && netInfo.isConnected()) {
        return true;
    }
    return false;
}



class MailSender extends AsyncTask<Void, Integer, Integer>
{

	ProgressDialog pd = null;


	@Override
	protected void onPreExecute()
	{
		// TODO Auto-generated method stub
		super.onPreExecute();
		

	}

	
	@Override
	protected Integer doInBackground(Void... params) 
	{


		Mail m = new Mail(GMAIL_EMAIL_ID, GMAIL_ACCOUNT_PASSWORD);

		String toAddresses = Global.TO_ADDRESSES;
		m.setToAddresses(toAddresses);
		m.setFromAddress(GMAIL_EMAIL_ID);
		m.setMailSubject("Survey Desk!!!");
		m.setMailBody("Poast Has been made by "+Global.username +" **This message has been recieved from Your Survey Desk**");

		try 
		{
			
			 	
				
				
				if (m.send()) {
					System.out.println("Message sent");
					return 1;
				} else {
					return 2;
				}
				 
			

		} catch (Exception e) {
			Log.e("MailApp", "Could not send email", e);
		}
		return 3;
	}


	@Override
	protected void onPostExecute(Integer result) {
		super.onPostExecute(result);
	
		if (result == 1)
			Toast.makeText(Dering_Pengelola_8.this,
					"Email was sent successfully.", Toast.LENGTH_LONG)
					.show();
		else if (result == 2)
			Toast.makeText(Dering_Pengelola_8.this, "Email was not sent.",
					Toast.LENGTH_LONG).show();
		else if (result == 3)
			Toast.makeText(Dering_Pengelola_8.this,
					"There was a problem sending the email.",
					Toast.LENGTH_LONG).show();
		Intent intent=new Intent(getApplicationContext(),Home.class);
		startActivity(intent);
		Dering_Pengelola_8.this.finish();
        
	}
}

@Override
protected void onActivityResult(int requestCode, int resultCode, Intent data) {
	try{
		
		if (resultCode == RESULT_OK && requestCode == CAMERA_RESULT) {
			   File out = new File(_path);
//			   Toast.makeText(getApplicationContext(), "Captured", Toast.LENGTH_SHORT).show();
				   Bitmap bmp = BitmapFactory.decodeFile("mnt/sdcard/"+newimgname+".jpg");
				   if(image_flag==1)
				   {
				   img.setImageBitmap(bmp);
				   }
				   else if(image_flag==2)
				   {
				   img1.setImageBitmap(bmp);
				   }
				   filePath=_path;
				   if(image_flag==1)
				   {
					   Global.image_path1=filePath;
				   }
				   else if(image_flag==2)
				   {
					   Global.image_path2=filePath;
				   }
				   nameimage=newimgname+".jpg";

			}
		
		
	switch (requestCode) {
	case PICK_IMAGE:
		if (resultCode == Activity.RESULT_OK) 
		{
			Uri selectedImageUri = data.getData();
		

			try {
				// OI FILE Manager
				String filemanagerstring = selectedImageUri.getPath();
			
				// MEDIA GALLERY
				String selectedImagePath = getPath(selectedImageUri);


				if (selectedImagePath != null)
				{
					filePath = selectedImagePath;
				} else if (filemanagerstring != null)
				{
					filePath = filemanagerstring;
				} else {
//					Toast.makeText(getApplicationContext(), "Unknown path",Toast.LENGTH_LONG).show();
//					Log.e("Bitmap", "Unknown path");
					System.out.println("Bitmap"+"Unknown path");
				}

				if (filePath != null)
				{
					String[] temp;
					 
					  /* delimiter */
					  String delimiter = "/";
					  /* given string will be split by the argument delimiter provided. */
					  temp = filePath.split(delimiter);
					  /* print substrings */
					  for(int i =0; i < temp.length ; i++){
					    System.out.println(temp[i]);
					  nameimage=temp[i];
					  System.out.println(nameimage);
					  }
					decodeFile(filePath);
					   if(image_flag==1)
					   {
						   Global.image_path1=filePath;
					   }
					   else if(image_flag==2)
					   {
						   Global.image_path2=filePath;
					   }
				} 
				else
				{
					bitmap = null;
				}
			}
			catch (Exception e) 
			{
				
				System.out.println(e);
			}
		}
		break;
	default:
	}
	}catch (Exception e) 
	{
		// TODO: handle exception
	System.out.println(e);
	}
}
public String getPath(Uri uri) 
{
	try{
	String[] projection = { MediaStore.Images.Media.DATA };
	Cursor cursor = managedQuery(uri, projection, null, null, null);
	if (cursor != null) {
		// HERE YOU WILL GET A NULLPOINTER IF CURSOR IS NULL
		// THIS CAN BE, IF YOU USED OI FILE MANAGER FOR PICKING THE MEDIA
		int column_index = cursor
				.getColumnIndexOrThrow(MediaStore.Images.Media.DATA);
		cursor.moveToFirst();
		return cursor.getString(column_index);
	} else
		return null;
	}catch (Exception e) {
		// TODO: handle exception
	System.out.println(e);
	}
	return null;
}

public void decodeFile(String filePath) {
	try{
	// Decode image size
	BitmapFactory.Options o = new BitmapFactory.Options();
	o.inJustDecodeBounds = true;
	BitmapFactory.decodeFile(filePath, o);

	// The new size we want to scale to
	final int REQUIRED_SIZE = 1024;

	// Find the correct scale value. It should be the power of 2.
	int width_tmp = o.outWidth, height_tmp = o.outHeight;
	int scale = 1;
	while (true) {
		if (width_tmp < REQUIRED_SIZE && height_tmp < REQUIRED_SIZE)
			break;
		width_tmp /= 2;
		height_tmp /= 2;
		scale *= 2;
	}

	// Decode with inSampleSize
	BitmapFactory.Options o2 = new BitmapFactory.Options();
	o2.inSampleSize = scale;
	bitmap = BitmapFactory.decodeFile(filePath, o2);

	 if(image_flag==1)
	   {
	   img.setImageBitmap(bitmap);
	   }
	   else if(image_flag==2)
	   {
	   img1.setImageBitmap(bitmap);
	   }
	}catch (Exception e) {
		// TODO: handle exception
	System.out.println(e);
	}
}

 @Override
	public Dialog onCreateDialog(int id) {
	
	    switch(id) {
	    case CUSTOM_DIALOG_ID:
	    {
	    	try{
	     dialog = new Dialog(Dering_Pengelola_8.this);
	 
	     dialog.setContentView(R.layout.choosecamlayout);
	     dialog.setTitle(" Select");
	     
	     
	     fromgallery = (TextView)dialog.findViewById(R.id.fromgallery);
	     fromgallery.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
		dialog.dismiss();
			choosefromgallery();	
			}
		});
	     
	     
	     takeimage=(TextView)dialog.findViewById(R.id.captphoto);
	     takeimage.setOnClickListener(new OnClickListener() {
			
			public void onClick(View v) {
				// TODO Auto-generated method stub
				dialog.dismiss();
			takephoto();
			
			}
		});

	        break;
	    	}catch (Exception e) {
				// TODO: handle exception
				System.out.println(e);
			}
	    }    
	    
	    }
	    return dialog;
	}

 public String generatePin() throws Exception
	{  
		Random generator = new Random();  
		generator.setSeed(System.currentTimeMillis());  
		   
		int num = generator.nextInt(99999) + 99999;  
		if (num < 100000 || num > 999999) {  
		num = generator.nextInt(99999) + 99999;  
		if (num < 100000 || num > 999999) {  
		throw new Exception("Unable to generate random at this time..");  
		}  
		}  
		return ""+num;  
	}
private void takephoto()
{
//Toast.makeText(getApplicationContext(), "Capture", Toast.LENGTH_SHORT).show();
try {
	newimgname=generatePin().trim().toString();
	
} catch (Exception e) {
	// TODO Auto-generated catch block
	e.printStackTrace();
}
_path = Environment.getExternalStorageDirectory() + "/"+newimgname+".jpg";
File file = new File( _path );
Uri outputFileUri = Uri.fromFile( file );

Intent intent = new Intent(android.provider.MediaStore.ACTION_IMAGE_CAPTURE );
intent.putExtra( MediaStore.EXTRA_OUTPUT, outputFileUri );
startActivityForResult( intent, 0 );
}		
private void choosefromgallery()
{
	try 
	{
		Intent intent = new Intent();
		intent.setType("image/*");
		intent.setAction(Intent.ACTION_GET_CONTENT);
		startActivityForResult(
		Intent.createChooser(intent, "Select Picture"),PICK_IMAGE);
	} 
	catch (Exception e)
	{
		Toast.makeText(getApplicationContext(),e.getMessage(),Toast.LENGTH_LONG).show();
		System.out.println(e);
	}
}
public int doing()

{

try
{
fileName=Global.image_path1;
HttpURLConnection conn = null;
DataOutputStream dos = null; 
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
File sourceFile = new File(Global.image_path1);
if (!sourceFile.isFile())
{

}
    try 
    {
     FileInputStream fileInputStream = new FileInputStream(sourceFile);
     URL url = new URL(Global.upload_url);
     conn = (HttpURLConnection) url.openConnection(); 
     conn.setDoInput(true); 
     conn.setDoOutput(true); 
     conn.setUseCaches(false); 
     conn.setRequestMethod("POST");
     conn.setRequestProperty("Connection", "Keep-Alive");
     conn.setRequestProperty("ENCTYPE", "multipart/form-data");
     conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
     conn.setRequestProperty("uploadedfile", fileName );
     dos = new DataOutputStream(conn.getOutputStream());

     dos.writeBytes(twoHyphens + boundary + lineEnd);
     dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\""+ fileName + "\"" + lineEnd);
     dos.writeBytes(lineEnd);

     bytesAvailable = fileInputStream.available();

     bufferSize = Math.min(bytesAvailable, maxBufferSize);
     buffer = new byte[bufferSize];

     bytesRead = fileInputStream.read(buffer, 0, bufferSize); 
       
     while (bytesRead > 0)
     {
       dos.write(buffer, 0, bufferSize);
       bytesAvailable = fileInputStream.available();
       bufferSize = Math.min(bytesAvailable, maxBufferSize);
       bytesRead = fileInputStream.read(buffer, 0, bufferSize);              
      }


     dos.writeBytes(lineEnd);
     dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
     serverResponseCode = conn.getResponseCode();
      serverResponseMessage = conn.getResponseMessage();
     if(serverResponseCode == 200){
         runOnUiThread(new Runnable()
         {
              public void run()
              {

              }
          });               
     }   
     
     fileInputStream.close();
     dos.flush();
     dos.close();
      
} catch (MalformedURLException ex) 
{ 

    System.out.println( ex.getMessage());
   // Toast.makeText(Desa_Form7.this, "MalformedURLException", Toast.LENGTH_SHORT).show();
} catch (Exception e)
{

    System.out.println( e.getMessage());
  //  Toast.makeText(Desa_Form7.this, "Exception : " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
  
}
catch(Exception e)
{
	System.out.println(e);
}
return 1;

}

public int doing1()

{

try
{
fileName=Global.image_path2;
HttpURLConnection conn = null;
DataOutputStream dos = null; 
String lineEnd = "\r\n";
String twoHyphens = "--";
String boundary = "*****";
int bytesRead, bytesAvailable, bufferSize;
byte[] buffer;
int maxBufferSize = 1 * 1024 * 1024;
File sourceFile = new File(Global.image_path2);
if (!sourceFile.isFile())
{

}
    try 
    {
     FileInputStream fileInputStream = new FileInputStream(sourceFile);
     URL url = new URL(Global.upload_url);
     conn = (HttpURLConnection) url.openConnection(); 
     conn.setDoInput(true); 
     conn.setDoOutput(true); 
     conn.setUseCaches(false); 
     conn.setRequestMethod("POST");
     conn.setRequestProperty("Connection", "Keep-Alive");
     conn.setRequestProperty("ENCTYPE", "multipart/form-data");
     conn.setRequestProperty("Content-Type", "multipart/form-data;boundary=" + boundary);
     conn.setRequestProperty("uploadedfile", fileName );
     dos = new DataOutputStream(conn.getOutputStream());

     dos.writeBytes(twoHyphens + boundary + lineEnd);
     dos.writeBytes("Content-Disposition: form-data; name=\"uploadedfile\";filename=\""+ fileName + "\"" + lineEnd);
     dos.writeBytes(lineEnd);

     bytesAvailable = fileInputStream.available();

     bufferSize = Math.min(bytesAvailable, maxBufferSize);
     buffer = new byte[bufferSize];

     bytesRead = fileInputStream.read(buffer, 0, bufferSize); 
       
     while (bytesRead > 0)
     {
       dos.write(buffer, 0, bufferSize);
       bytesAvailable = fileInputStream.available();
       bufferSize = Math.min(bytesAvailable, maxBufferSize);
       bytesRead = fileInputStream.read(buffer, 0, bufferSize);              
      }


     dos.writeBytes(lineEnd);
     dos.writeBytes(twoHyphens + boundary + twoHyphens + lineEnd);
     serverResponseCode1 = conn.getResponseCode();
      serverResponseMessage1 = conn.getResponseMessage();
     if(serverResponseCode1== 200){
         runOnUiThread(new Runnable()
         {
              public void run()
              {

              }
          });               
     }   
     
     fileInputStream.close();
     dos.flush();
     dos.close();
      
} catch (MalformedURLException ex) 
{ 

    System.out.println( ex.getMessage());
 //   Toast.makeText(Desa_Form7.this, "MalformedURLException", Toast.LENGTH_SHORT).show();
} catch (Exception e)
{
System.out.println( e.getMessage());
 //   Toast.makeText(Desa_Form7.this, "Exception : " + e.getMessage(), Toast.LENGTH_SHORT).show();
}
  
}
catch(Exception e)
{
	System.out.println(e);
}
return 1;

}


}
